Abstraction layer to be used for central accelerometer in an airbag. Upper layers shall make requests to the peripheral through this file to avoid peripheral-specific dependencies.
More...
Go to the source code of this file.
Defines |
|
#define | TRUE (1u) |
|
#define | CLEAR (0u) |
|
#define | BITS_IN_NIBBLE (4u) |
|
#define | BITS_IN_BYTE (8u) |
|
#define | BYTES_IN_16 (2u) |
|
#define | BYTES_IN_32 (4u) |
|
#define | BIT_DEFINITION |
|
#define | BIT0 (1u << 0u) |
|
#define | BIT1 (1u << 1u) |
|
#define | BIT2 (1u << 2u) |
|
#define | BIT3 (1u << 3u) |
|
#define | BIT4 (1u << 4u) |
|
#define | BIT5 (1u << 5u) |
|
#define | BIT6 (1u << 6u) |
|
#define | BIT7 (1u << 7u) |
|
#define | BIT8 (1u << 8u) |
|
#define | BIT9 (1u << 9u) |
|
#define | BIT10 (1u << 10) |
|
#define | BIT11 (1u << 11) |
|
#define | BIT12 (1u << 12) |
|
#define | BIT13 (1u << 13) |
|
#define | BIT14 (1u << 14) |
|
#define | BIT15 (1u << 15) |
|
#define | BIT16 (1u << 16) |
|
#define | BIT17 (1u << 17) |
|
#define | BIT18 (1u << 18) |
|
#define | BIT19 (1u << 19) |
|
#define | BIT20 (1u << 20) |
|
#define | BIT21 (1u << 21) |
|
#define | BIT22 (1u << 22) |
|
#define | BIT23 (1u << 23) |
|
#define | BIT24 (1u << 24) |
|
#define | BIT25 (1u << 25) |
|
#define | BIT26 (1u << 26) |
|
#define | BIT27 (1u << 27) |
|
#define | BIT28 (1u << 28) |
|
#define | BIT29 (1u << 29) |
|
#define | BIT30 (1u << 30) |
|
#define | BIT31 (1u << 31) |
|
#define | CURRENT_CA SYCAMORE |
|
#define | CURRENT_ACCEL_MODE 3u |
|
#define | STATUS_CA_FAILED (BIT27 | BIT26) |
|
#define | N_ELEMENTS(X) (sizeof(X)/sizeof(*(X))) |
|
#define | u32fnExtractY u32fnExtractX |
Functions |
| void | vfnCAPreSchedulerInit (void) |
| | Performs default initialization of the central accelerometer as required before launching scheduler (other CA than FSL ones). Entirely empty.
|
| uint32_t | u32fnCAInit (void) |
| | Performs default initialization of the central accelerometer as required before launching scheduler. This initialization includes reset, loading of settings, startup diagnosis and finally the raising of EOP bit.
|
| uint32_t | u32fnCAScheduleAccelXY (uint16_t *pu16RawDestination) |
| | Using the scheduler, programs an XY accelerometer reading.
|
| uint32_t | u32fnCAScheduleAccelX (uint16_t *pu16RawDestination) |
| | Using the scheduler, programs an X accelerometer reading.
|
| uint32_t | u32fnCAScheduleAccelY (uint16_t *pu16RawDestination) |
| | Using the scheduler, programs a Y accelerometer reading.
|
| uint32_t | u32fnCAExtractXY (uint16_t *pu16RawSource, uint16_t *pu16FilteredXY) |
| | Interprets a raw result and transforms it into a 2-word array with X and Y acceleration values.
|
| uint32_t | u32fnCAExtractX (uint16_t *pu16RawSource, uint16_t *pu16FilteredX) |
| | Interprets a raw result and transforms it into a 16-bit word.
|
| uint32_t | u32fnCAInitSelfTest (void) |
| | Performs the self test diagnosis (Pre, ON, Post) at startup for both X and Y axis.
|
| uint32_t | u32fnCASelfTest (const uint8_t cu8Axis) |
| | Performs the self test diagnosis (Pre, ON, Post) for one axis.
|
Variables |
| const uint16_t | cau16MMA6800ResetSettings [] |
|
const uint16_t | cau16MMA6800InitSettings [] |
|
const uint8_t | cu8SizeofMMA6800ResetSettings |
|
const uint8_t | cu8SizeofMMA6800InitSettings |
Detailed Description
Abstraction layer to be used for central accelerometer in an airbag. Upper layers shall make requests to the peripheral through this file to avoid peripheral-specific dependencies.
Copyright (C) 2011 Freescale Semiconductor Freescale Confidential Proprietary
- Author:
- Freescale Semiconductor
-
SASD Automotive
-
R11515
-
R54967
- Version:
- Date:
- Warning:
- (If needed)
History:
Function Documentation
| uint32_t u32fnCAExtractX |
( |
uint16_t * |
pu16RawSource, |
|
|
uint16_t * |
pu16FilteredX |
|
) |
| |
Interprets a raw result and transforms it into a 16-bit word.
- Parameters:
-
| pu16RawSource,: | Array with data directly after the response has been received |
| pu16FilteredXY,: | Pointer to location where the accel value will be stored. |
- Returns:
- Status. Clear when no error found, STATUS_CA_FAILED otherwise.
| uint32_t u32fnCAExtractXY |
( |
uint16_t * |
pu16RawSource, |
|
|
uint16_t * |
pu16FilteredXY |
|
) |
| |
Interprets a raw result and transforms it into a 2-word array with X and Y acceleration values.
- Parameters:
-
| pu16RawSource,: | Array with data directly after the response has been received |
| pu16FilteredXY,: | Pointer to a 2-word array where the X and Y results will be stored. |
- Returns:
- Status. Clear when no error found, STATUS_CA_FAILED otherwise.
| uint32_t u32fnCAInit |
( |
void |
| ) |
|
Performs default initialization of the central accelerometer as required before launching scheduler. This initialization includes reset, loading of settings, startup diagnosis and finally the raising of EOP bit.
- Parameters:
-
- Returns:
- Status: Clear when no error found, otherwise is a combination of STATUS_CA_RAW_X_FAILED if Raw data and X axis test1 failed STATUS_CA_OC_X_FAILED if OC data and X axis test1 failed STATUS_CA_RAW_Y_FAILED if Raw data and Y axis test1 failed STATUS_CA_OC_Y_FAILED if OC data and Y axis test1 failed STATUS_CA_RAW_SELF_X_FAILED if Raw data and X axis test2 failed STATUS_CA_OC_SELF_X_FAILED if OC data and X axis test2 failed STATUS_CA_RAW_SELF_Y_FAILED if Raw data and Y axis test2 failed STATUS_CA_OC_SELF_Y_FAILED if OC data and Y axis test2 failed STATUS_CA_RAW_HYST_X_FAILED if Raw data and X axis test3 failed STATUS_CA_OC_HYST_X_FAILED if OC data and X axis test3 failed STATUS_CA_RAW_HYST_Y_FAILED if Raw data and Y axis test3 failed STATUS_CA_OC_HYST_Y_FAILED if OC data and Y axis test3 failed or MAILBOX_CAPACITY_HAS_BEEN_REACHED if SPI transfer failed
| uint32_t u32fnCAInitSelfTest |
( |
void |
| ) |
|
Performs the self test diagnosis (Pre, ON, Post) at startup for both X and Y axis.
- Returns:
- Status: Clear when no error found, otherwise is a combination of STATUS_CA_RAW_X_FAILED if Raw data and X axis test1 failed STATUS_CA_OC_X_FAILED if OC data and X axis test1 failed STATUS_CA_RAW_Y_FAILED if Raw data and Y axis test1 failed STATUS_CA_OC_Y_FAILED if OC data and Y axis test1 failed STATUS_CA_RAW_SELF_X_FAILED if Raw data and X axis test2 failed STATUS_CA_OC_SELF_X_FAILED if OC data and X axis test2 failed STATUS_CA_RAW_SELF_Y_FAILED if Raw data and Y axis test2 failed STATUS_CA_OC_SELF_Y_FAILED if OC data and Y axis test2 failed STATUS_CA_RAW_HYST_X_FAILED if Raw data and X axis test3 failed STATUS_CA_OC_HYST_X_FAILED if OC data and X axis test3 failed STATUS_CA_RAW_HYST_Y_FAILED if Raw data and Y axis test3 failed STATUS_CA_OC_HYST_Y_FAILED if OC data and Y axis test3 failed or MAILBOX_CAPACITY_HAS_BEEN_REACHED if SPI transfer failed
| uint32_t u32fnCAScheduleAccelX |
( |
uint16_t * |
pu16RawDestination | ) |
|
Using the scheduler, programs an X accelerometer reading.
- Parameters:
-
| pu16RawDestination,: | Array where the response from the commands will be stored. |
- Returns:
- Status. Clear when no error found, STATUS_CA_FAILED otherwise.
| uint32_t u32fnCAScheduleAccelXY |
( |
uint16_t * |
pu16RawDestination | ) |
|
Using the scheduler, programs an XY accelerometer reading.
- Parameters:
-
| pu16RawDestination,: | Array where the response from the commands will be stored. |
- Returns:
- Status. Clear when no error found, STATUS_CA_FAILED otherwise.
| uint32_t u32fnCAScheduleAccelY |
( |
uint16_t * |
pu16RawDestination | ) |
|
Using the scheduler, programs a Y accelerometer reading.
- Parameters:
-
| pu16RawDestination,: | Array where the response from the commands will be stored. |
- Returns:
- Status. Clear when no error found, STATUS_CA_FAILED otherwise.
| uint32_t u32fnCASelfTest |
( |
const uint8_t |
cu8Axis | ) |
|
Performs the self test diagnosis (Pre, ON, Post) for one axis.
- Parameters:
-
| cu8Axis,: | Axis along which self test is performed. STATUS_CA_RAW_X_FAILED if Raw data and X axis test1 failed STATUS_CA_OC_X_FAILED if OC data and X axis test1 failed STATUS_CA_RAW_Y_FAILED if Raw data and Y axis test1 failed STATUS_CA_OC_Y_FAILED if OC data and Y axis test1 failed STATUS_CA_RAW_SELF_X_FAILED if Raw data and X axis test2 failed STATUS_CA_OC_SELF_X_FAILED if OC data and X axis test2 failed STATUS_CA_RAW_SELF_Y_FAILED if Raw data and Y axis test2 failed STATUS_CA_OC_SELF_Y_FAILED if OC data and Y axis test2 failed STATUS_CA_RAW_HYST_X_FAILED if Raw data and X axis test3 failed STATUS_CA_OC_HYST_X_FAILED if OC data and X axis test3 failed STATUS_CA_RAW_HYST_Y_FAILED if Raw data and Y axis test3 failed STATUS_CA_OC_HYST_Y_FAILED if OC data and Y axis test3 failed or MAILBOX_CAPACITY_HAS_BEEN_REACHED if SPI transfer failed |
| void vfnCAPreSchedulerInit |
( |
void |
| ) |
|
Performs default initialization of the central accelerometer as required before launching scheduler (other CA than FSL ones). Entirely empty.
- Parameters:
-
- Returns:
- Void.
Variable Documentation
Initial settings for the existing Central accelerometer. These may not be necessary if the CA changes.